package com.liuwang.meal.manager;


import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import com.liuwang.meal.db.DBHelper;
import com.liuwang.meal.db.Orders;
import com.liuwang.meal.util.MyUtil;

public class OrderManager {
	private Context context = null;

	public OrderManager(Context context) {
		this.context = context;
	}
	
	// 添加订单
	public void addOrder(int user_id,int table_id,String table_no,int personNum){
		
		// 获取数据库
		DBHelper db = new DBHelper(this.context);
		SQLiteDatabase database = db.getWritableDatabase();
		String sql = "insert into "+Orders.TABLE+" (orderTime,userID,tableID,isPay,personNum,remark) " + "values ('"
		+ MyUtil.getCurrentTime() + "','" 
		+ user_id + "','" 
		+ table_id + "','0','" 
		+ personNum + "','')";
     	// 执行语句
		database.execSQL(sql);
    	// 关闭数据库
    	database.close();
	}
}
